package com.sleepcamel.resteasyConfigurator.repository;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;

public class FileMimeTypeRepository extends BaseMimeTypeRepository {

	private File file;

	public FileMimeTypeRepository(File mimeTypesFile) throws FileNotFoundException {
		super(new FileInputStream(mimeTypesFile));
		this.file = mimeTypesFile;
	}
	
	@Override
	public List<String> getMimeTypes() {
		return types;
	}

	@Override
	public boolean addMimeType(String mime) {
		if ( mime == null || mime.isEmpty() || types.contains(mime.toLowerCase()) )
			return false;

		types.add(mime.toLowerCase());
		// TODO Implement
		// Should open the file, and write the new value to it
		// Return whether the operation was successful
		
		return false;
	}

}
